From 1384050eeae5e66efca4487ead8422ea9e4202ce Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Thu, 12 Feb 2015 23:10:07 -0500 Subject: [PATCH] update Rust --- Cargo.lock | 32 +++++++++--------- src/bin/build.rs | 4 +-- src/bin/cargo.rs | 2 +- src/bin/clean.rs | 4 +-- src/bin/generate_lockfile.rs | 4 +-- src/bin/new.rs | 4 +-- src/bin/update.rs | 4 +-- src/bin/verify_project.rs | 4 +-- src/bin/version.rs | 4 +-- src/cargo/lib.rs | 2 +- src/cargo/ops/cargo_new.rs | 4 +-- src/cargo/ops/cargo_rustc/engine.rs | 2 +- src/cargo/ops/registry.rs | 4 +-- src/cargo/sources/git/utils.rs | 3 +- src/cargo/util/config.rs | 2 +- src/cargo/util/hex.rs | 5 ++- src/cargo/util/profile.rs | 2 +- src/rustversion.txt | 2 +- tests/support/mod.rs | 2 +- tests/test_cargo.rs | 2 +- tests/test_cargo_compile.rs | 10 +++--- tests/test_cargo_compile_custom_build.rs | 42 ++++++++++++------------ tests/test_cargo_compile_git_deps.rs | 24 +++++++------- tests/test_cargo_compile_plugins.rs | 6 ++-- tests/test_cargo_cross_compile.rs | 28 ++++++++-------- tests/test_cargo_profiles.rs | 6 ++-- 26 files changed, 103 insertions(+), 105 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14dd8761b..629585c5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = "0.1.0" dependencies = [ "advapi32-sys 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 0.6.36 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 0.6.37 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "git2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -18,8 +18,8 @@ dependencies = [ "semver 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -44,7 +44,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -55,13 +55,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "docopt" -version = "0.6.36" +version = "0.6.37" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "regex 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -97,7 +97,7 @@ version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -136,13 +136,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libgit2-sys" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libssh2-sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -159,7 +159,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libz-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -192,12 +192,12 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.3.3" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -207,7 +207,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pkg-config" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -255,7 +255,7 @@ dependencies = [ [[package]] name = "time" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -264,7 +264,7 @@ dependencies = [ [[package]] name = "toml" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rustc-serialize 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/bin/build.rs b/src/bin/build.rs index a617f6459..0784c047a 100644 --- a/src/bin/build.rs +++ b/src/bin/build.rs @@ -1,4 +1,4 @@ -use std::os; +use std::env; use cargo::ops::CompileOptions; use cargo::ops; @@ -47,7 +47,7 @@ the --release flag will use the `release` profile instead. "; pub fn execute(options: Options, config: &Config) -> CliResult> { - debug!("executing; cmd=cargo-build; args={:?}", os::args()); + debug!("executing; cmd=cargo-build; args={:?}", env::args().collect::>()); config.shell().set_verbose(options.flag_verbose); let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path)); diff --git a/src/bin/cargo.rs b/src/bin/cargo.rs index 7bf0a1161..53c904d34 100644 --- a/src/bin/cargo.rs +++ b/src/bin/cargo.rs @@ -245,7 +245,7 @@ fn list_command_directory() -> Vec { dirs.push(path.join("../lib/cargo")); dirs.push(path); } - if let Some(val) = env::var("PATH") { + if let Some(val) = env::var_os("PATH") { dirs.extend(env::split_paths(&val)); } dirs diff --git a/src/bin/clean.rs b/src/bin/clean.rs index dcc013e46..a530b9b24 100644 --- a/src/bin/clean.rs +++ b/src/bin/clean.rs @@ -1,4 +1,4 @@ -use std::os; +use std::env; use cargo::ops; use cargo::util::{CliResult, CliError, Config}; @@ -33,7 +33,7 @@ and its format, see the `cargo help pkgid` command. pub fn execute(options: Options, config: &Config) -> CliResult> { config.shell().set_verbose(options.flag_verbose); - debug!("executing; cmd=cargo-clean; args={:?}", os::args()); + debug!("executing; cmd=cargo-clean; args={:?}", env::args().collect::>()); let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path)); let opts = ops::CleanOptions { diff --git a/src/bin/generate_lockfile.rs b/src/bin/generate_lockfile.rs index a350ab632..d9777ef66 100644 --- a/src/bin/generate_lockfile.rs +++ b/src/bin/generate_lockfile.rs @@ -1,4 +1,4 @@ -use std::os; +use std::env; use cargo::ops; use cargo::util::{CliResult, CliError, Config}; @@ -23,7 +23,7 @@ Options: "; pub fn execute(options: Options, config: &Config) -> CliResult> { - debug!("executing; cmd=cargo-generate-lockfile; args={:?}", os::args()); + debug!("executing; cmd=cargo-generate-lockfile; args={:?}", env::args().collect::>()); config.shell().set_verbose(options.flag_verbose); let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path)); diff --git a/src/bin/new.rs b/src/bin/new.rs index 4126e3826..0abff6a57 100644 --- a/src/bin/new.rs +++ b/src/bin/new.rs @@ -1,4 +1,4 @@ -use std::os; +use std::env; use cargo::ops; use cargo::util::{CliResult, CliError, Config}; @@ -28,7 +28,7 @@ Options: "; pub fn execute(options: Options, config: &Config) -> CliResult> { - debug!("executing; cmd=cargo-new; args={:?}", os::args()); + debug!("executing; cmd=cargo-new; args={:?}", env::args().collect::>()); config.shell().set_verbose(options.flag_verbose); let Options { flag_bin, arg_path, flag_vcs, .. } = options; diff --git a/src/bin/update.rs b/src/bin/update.rs index fa75506bc..4fdeebfb6 100644 --- a/src/bin/update.rs +++ b/src/bin/update.rs @@ -1,4 +1,4 @@ -use std::os; +use std::env; use cargo::ops; use cargo::util::{CliResult, CliError, Config}; @@ -49,7 +49,7 @@ For more information about package id specifications, see `cargo help pkgid`. "; pub fn execute(options: Options, config: &Config) -> CliResult> { - debug!("executing; cmd=cargo-update; args={:?}", os::args()); + debug!("executing; cmd=cargo-update; args={:?}", env::args().collect::>()); config.shell().set_verbose(options.flag_verbose); let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path)); diff --git a/src/bin/verify_project.rs b/src/bin/verify_project.rs index 54f8d6e80..816c5e9bb 100644 --- a/src/bin/verify_project.rs +++ b/src/bin/verify_project.rs @@ -1,8 +1,8 @@ extern crate toml; use std::collections::HashMap; +use std::env; use std::old_io::File; -use std::os; use cargo::util::{CliResult, Config}; @@ -47,6 +47,6 @@ pub fn execute(args: Flags, config: &Config) -> CliResult> { fn fail(reason: &str, value: &str) -> CliResult>{ let mut h = HashMap::new(); h.insert(reason.to_string(), value.to_string()); - os::set_exit_status(1); + env::set_exit_status(1); Ok(Some(h)) } diff --git a/src/bin/version.rs b/src/bin/version.rs index e1bc0116f..b5622f225 100644 --- a/src/bin/version.rs +++ b/src/bin/version.rs @@ -1,4 +1,4 @@ -use std::os; +use std::env; use cargo; use cargo::util::{CliResult, Config}; @@ -16,7 +16,7 @@ Options: "; pub fn execute(_: Options, _: &Config) -> CliResult> { - debug!("executing; cmd=cargo-version; args={:?}", os::args()); + debug!("executing; cmd=cargo-version; args={:?}", env::args().collect::>()); println!("{}", cargo::version()); diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs index 609e1bd84..d5737efd9 100644 --- a/src/cargo/lib.rs +++ b/src/cargo/lib.rs @@ -95,7 +95,7 @@ fn process(mut callback: F) let mut shell = shell(true); process_executed((|| { let config = try!(Config::new(&mut shell)); - let args: Vec<_> = try!(env::args().map(|s| { + let args: Vec<_> = try!(env::args_os().map(|s| { s.into_string().map_err(|s| { human(format!("invalid unicode in argument: {:?}", s)) }) diff --git a/src/cargo/ops/cargo_new.rs b/src/cargo/ops/cargo_new.rs index 09d83185a..ae9d5e54f 100644 --- a/src/cargo/ops/cargo_new.rs +++ b/src/cargo/ops/cargo_new.rs @@ -134,8 +134,8 @@ fn discover_author() -> CargoResult<(String, Option)> { let git_config = git_config.as_ref(); let name = git_config.and_then(|g| g.get_str("user.name").ok()) .map(|s| s.to_string()) - .or_else(|| env::var_string("USER").ok()) // unix - .or_else(|| env::var_string("USERNAME").ok()); // windows + .or_else(|| env::var("USER").ok()) // unix + .or_else(|| env::var("USERNAME").ok()); // windows let name = match name { Some(name) => name, None => { diff --git a/src/cargo/ops/cargo_rustc/engine.rs b/src/cargo/ops/cargo_rustc/engine.rs index 5c6a0efdd..9d234f882 100644 --- a/src/cargo/ops/cargo_rustc/engine.rs +++ b/src/cargo/ops/cargo_rustc/engine.rs @@ -85,7 +85,7 @@ impl CommandPrototype { pub fn get_env(&self, var: &str) -> Option { self.env.get(var).cloned().or_else(|| { - Some(env::var_string(var).ok().map(|s| CString::from_vec(s.into_bytes()))) + Some(env::var(var).ok().map(|s| CString::from_vec(s.into_bytes()))) }).and_then(|val| val) } diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index 2461981b8..59754f20b 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -191,7 +191,7 @@ pub fn http_proxy(config: &Config) -> CargoResult> { } Err(..) => {} } - Ok(env::var_string("HTTP_PROXY").ok()) + Ok(env::var("HTTP_PROXY").ok()) } pub fn http_timeout(config: &Config) -> CargoResult> { @@ -199,7 +199,7 @@ pub fn http_timeout(config: &Config) -> CargoResult> { Some((s, _)) => return Ok(Some(s)), None => {} } - Ok(env::var_string("HTTP_TIMEOUT").ok().and_then(|s| s.parse().ok())) + Ok(env::var("HTTP_TIMEOUT").ok().and_then(|s| s.parse().ok())) } pub fn registry_login(config: &Config, token: String) -> CargoResult<()> { diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs index 898f08270..9861ed6e7 100644 --- a/src/cargo/sources/git/utils.rs +++ b/src/cargo/sources/git/utils.rs @@ -308,7 +308,8 @@ impl<'a> GitCheckout<'a> { // as the submodule's head, then we can bail out and go to the // next submodule. let head_and_repo = child.open().and_then(|repo| { - Ok((try!(repo.head()).target(), repo)) + let target = try!(repo.head()).target(); + Ok((target, repo)) }); let repo = match head_and_repo { Ok((head, repo)) => { diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index 217d02811..076e68d60 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -380,7 +380,7 @@ impl ConfigValue { } fn homedir() -> Option { - let cargo_home = env::var_string("CARGO_HOME").map(|p| Path::new(p)).ok(); + let cargo_home = env::var("CARGO_HOME").map(|p| Path::new(p)).ok(); let user_home = env::home_dir().map(|p| p.join(".cargo")); return cargo_home.or(user_home); } diff --git a/src/cargo/util/hex.rs b/src/cargo/util/hex.rs index 2bce7ea2e..3e8d9629a 100644 --- a/src/cargo/util/hex.rs +++ b/src/cargo/util/hex.rs @@ -1,12 +1,11 @@ -use std::old_io::MemWriter; use std::hash::{Hasher, Hash, SipHasher}; use rustc_serialize::hex::ToHex; pub fn to_hex(num: u64) -> String { - let mut writer = MemWriter::with_capacity(8); + let mut writer = Vec::with_capacity(8); writer.write_le_u64(num).unwrap(); // this should never fail - writer.get_ref().to_hex() + writer.to_hex() } pub fn short_hash>(hashable: &H) -> String { diff --git a/src/cargo/util/profile.rs b/src/cargo/util/profile.rs index 9d19c36dd..100fd2c36 100644 --- a/src/cargo/util/profile.rs +++ b/src/cargo/util/profile.rs @@ -14,7 +14,7 @@ pub struct Profiler { desc: String, } -fn enabled() -> bool { env::var("CARGO_PROFILE").is_some() } +fn enabled() -> bool { env::var_os("CARGO_PROFILE").is_some() } pub fn start(desc: T) -> Profiler { if !enabled() { return Profiler { desc: String::new() } } diff --git a/src/rustversion.txt b/src/rustversion.txt index e2a057dc7..17cae77fb 100644 --- a/src/rustversion.txt +++ b/src/rustversion.txt @@ -1 +1 @@ -2015-02-09 +2015-02-12 diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 83be2957b..7c10756ae 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -227,7 +227,7 @@ impl ErrMsg for Result { // Path to cargo executables pub fn cargo_dir() -> Path { - env::var_string("CARGO_BIN_PATH").map(Path::new).ok() + env::var("CARGO_BIN_PATH").map(Path::new).ok() .or_else(|| env::current_exe().ok().map(|s| s.dir_path())) .unwrap_or_else(|| { panic!("CARGO_BIN_PATH wasn't set. Cannot continue running test") diff --git a/tests/test_cargo.rs b/tests/test_cargo.rs index b4b1abd14..64e4c758c 100644 --- a/tests/test_cargo.rs +++ b/tests/test_cargo.rs @@ -25,7 +25,7 @@ fn fake_executable(proj: ProjectBuilder, dir: &Path, name: &str) -> ProjectBuild } fn path() -> Vec { - env::split_paths(&env::var("PATH").unwrap_or(OsString::new())).collect() + env::split_paths(&env::var_os("PATH").unwrap_or(OsString::new())).collect() } test!(list_commands_looks_at_path { diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 20fcab8d7..9c5b93435 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1259,7 +1259,7 @@ test!(freshness_ignores_excluded { exclude = ["src/b*.rs"] "#) .file("build.rs", "fn main() {}") - .file("src/lib.rs", "pub fn bar() -> int { 1 }"); + .file("src/lib.rs", "pub fn bar() -> i32 { 1 }"); foo.build(); foo.root().move_into_the_past().unwrap(); @@ -1297,15 +1297,15 @@ test!(rebuild_preserves_out_dir { use std::old_io::File; fn main() { - let path = Path::new(env::var_string("OUT_DIR").unwrap()).join("foo"); - if env::var("FIRST").is_some() { + let path = Path::new(env::var("OUT_DIR").unwrap()).join("foo"); + if env::var_os("FIRST").is_some() { File::create(&path).unwrap(); } else { File::create(&path).unwrap(); } } "#) - .file("src/lib.rs", "pub fn bar() -> int { 1 }"); + .file("src/lib.rs", "pub fn bar() -> i32 { 1 }"); foo.build(); foo.root().move_into_the_past().unwrap(); @@ -1335,7 +1335,7 @@ test!(dep_no_libs { [dependencies.bar] path = "bar" "#) - .file("src/lib.rs", "pub fn bar() -> int { 1 }") + .file("src/lib.rs", "pub fn bar() -> i32 { 1 }") .file("bar/Cargo.toml", r#" [package] name = "bar" diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index b110b86be..4ef727bdd 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -79,32 +79,32 @@ test!(custom_build_env_vars { use std::env; use std::old_io::fs::PathExtensions; fn main() {{ - let _target = env::var_string("TARGET").unwrap(); + let _target = env::var("TARGET").unwrap(); - let _ncpus = env::var_string("NUM_JOBS").unwrap(); + let _ncpus = env::var("NUM_JOBS").unwrap(); - let out = env::var_string("CARGO_MANIFEST_DIR").unwrap(); + let out = env::var("CARGO_MANIFEST_DIR").unwrap(); let p1 = Path::new(out); let cwd = env::current_dir().unwrap(); let p2 = cwd.join(Path::new(file!()).dir_path().dir_path()); assert!(p1 == p2, "{{}} != {{}}", p1.display(), p2.display()); - let opt = env::var_string("OPT_LEVEL").unwrap(); + let opt = env::var("OPT_LEVEL").unwrap(); assert_eq!(opt.as_slice(), "0"); - let opt = env::var_string("PROFILE").unwrap(); + let opt = env::var("PROFILE").unwrap(); assert_eq!(opt.as_slice(), "compile"); - let debug = env::var_string("DEBUG").unwrap(); + let debug = env::var("DEBUG").unwrap(); assert_eq!(debug.as_slice(), "true"); - let out = env::var_string("OUT_DIR").unwrap(); + let out = env::var("OUT_DIR").unwrap(); assert!(out.as_slice().starts_with(r"{0}")); assert!(Path::new(out).is_dir()); - let _host = env::var_string("HOST").unwrap(); + let _host = env::var("HOST").unwrap(); - let _feat = env::var_string("CARGO_FEATURE_FOO").unwrap(); + let _feat = env::var("CARGO_FEATURE_FOO").unwrap(); }} "#, p.root().join("target").join("build").display()); @@ -269,8 +269,8 @@ test!(overrides_and_links { .file("build.rs", r#" use std::env; fn main() { - assert_eq!(env::var_string("DEP_FOO_FOO").unwrap().as_slice(), "bar"); - assert_eq!(env::var_string("DEP_FOO_BAR").unwrap().as_slice(), "baz"); + assert_eq!(env::var("DEP_FOO_FOO").unwrap().as_slice(), "bar"); + assert_eq!(env::var("DEP_FOO_BAR").unwrap().as_slice(), "baz"); } "#) .file(".cargo/config", format!(r#" @@ -342,8 +342,8 @@ test!(links_passes_env_vars { .file("build.rs", r#" use std::env; fn main() { - assert_eq!(env::var_string("DEP_FOO_FOO").unwrap().as_slice(), "bar"); - assert_eq!(env::var_string("DEP_FOO_BAR").unwrap().as_slice(), "baz"); + assert_eq!(env::var("DEP_FOO_FOO").unwrap().as_slice(), "bar"); + assert_eq!(env::var("DEP_FOO_BAR").unwrap().as_slice(), "baz"); } "#) .file("a/Cargo.toml", r#" @@ -441,8 +441,8 @@ test!(rebuild_continues_to_pass_env_vars { .file("build.rs", r#" use std::env; fn main() { - assert_eq!(env::var_string("DEP_FOO_FOO").unwrap().as_slice(), "bar"); - assert_eq!(env::var_string("DEP_FOO_BAR").unwrap().as_slice(), "baz"); + assert_eq!(env::var("DEP_FOO_FOO").unwrap().as_slice(), "bar"); + assert_eq!(env::var("DEP_FOO_BAR").unwrap().as_slice(), "baz"); } "#); @@ -727,7 +727,7 @@ test!(out_dir_is_preserved { use std::env; use std::old_io::File; fn main() { - let out = env::var_string("OUT_DIR").unwrap(); + let out = env::var("OUT_DIR").unwrap(); File::create(&Path::new(out).join("foo")).unwrap(); } "#); @@ -742,7 +742,7 @@ test!(out_dir_is_preserved { use std::env; use std::old_io::File; fn main() { - let out = env::var_string("OUT_DIR").unwrap(); + let out = env::var("OUT_DIR").unwrap(); File::open(&Path::new(out).join("foo")).unwrap(); } "#).unwrap(); @@ -808,7 +808,7 @@ test!(code_generation { use std::old_io::File; fn main() { - let dst = Path::new(env::var_string("OUT_DIR").unwrap()); + let dst = Path::new(env::var("OUT_DIR").unwrap()); let mut f = File::create(&dst.join("hello.rs")).unwrap(); f.write_str(" pub fn message() -> &'static str { @@ -972,9 +972,9 @@ test!(test_a_lib_with_a_build_command { use std::old_io::File; fn main() { - let out = Path::new(env::var_string("OUT_DIR").unwrap()); + let out = Path::new(env::var("OUT_DIR").unwrap()); File::create(&out.join("foo.rs")).write_str(" - fn foo() -> int { 1 } + fn foo() -> i32 { 1 } ").unwrap(); } "#); @@ -1062,7 +1062,7 @@ test!(build_script_with_dynamic_native_dependency { use std::env; fn main() { - let src = Path::new(env::var_string("SRC").unwrap()); + let src = Path::new(env::var("SRC").unwrap()); println!("cargo:rustc-flags=-L {}", src.dir_path().display()); } "#) diff --git a/tests/test_cargo_compile_git_deps.rs b/tests/test_cargo_compile_git_deps.rs index 5777e1a52..11a152fbb 100644 --- a/tests/test_cargo_compile_git_deps.rs +++ b/tests/test_cargo_compile_git_deps.rs @@ -461,7 +461,7 @@ test!(two_revs_same_deps { version = "0.0.0" authors = [] "#) - .file("src/lib.rs", "pub fn bar() -> int { 1 }") + .file("src/lib.rs", "pub fn bar() -> i32 { 1 }") }).unwrap(); let repo = git2::Repository::open(&bar.root()).unwrap(); @@ -469,7 +469,7 @@ test!(two_revs_same_deps { // Commit the changes and make sure we trigger a recompile File::create(&bar.root().join("src/lib.rs")).write_str(r#" - pub fn bar() -> int { 2 } + pub fn bar() -> i32 { 2 } "#).unwrap(); add(&repo); let rev2 = commit(&repo); @@ -511,7 +511,7 @@ test!(two_revs_same_deps { "#, bar.url(), rev2).as_slice()) .file("src/lib.rs", r#" extern crate bar; - pub fn baz() -> int { bar::bar() } + pub fn baz() -> i32 { bar::bar() } "#); baz.build(); @@ -860,7 +860,7 @@ test!(stale_cached_version { version = "0.0.0" authors = [] "#) - .file("src/lib.rs", "pub fn bar() -> int { 1 }") + .file("src/lib.rs", "pub fn bar() -> i32 { 1 }") }).unwrap(); // Update the git database in the cache with the current state of the git @@ -887,7 +887,7 @@ test!(stale_cached_version { // Update the repo, and simulate someone else updating the lockfile and then // us pulling it down. File::create(&bar.root().join("src/lib.rs")).write_str(r#" - pub fn bar() -> int { 1 + 0 } + pub fn bar() -> i32 { 1 + 0 } "#).unwrap(); let repo = git2::Repository::open(&bar.root()).unwrap(); add(&repo); @@ -1090,7 +1090,7 @@ test!(git_build_cmd_freshness { build = "build.rs" "#) .file("build.rs", "fn main() {}") - .file("src/lib.rs", "pub fn bar() -> int { 1 }") + .file("src/lib.rs", "pub fn bar() -> i32 { 1 }") .file(".gitignore", " src/bar.rs ") @@ -1166,7 +1166,7 @@ test!(git_repo_changing_no_rebuild { version = "0.5.0" authors = ["wycats@example.com"] "#) - .file("src/lib.rs", "pub fn bar() -> int { 1 }") + .file("src/lib.rs", "pub fn bar() -> i32 { 1 }") }).unwrap(); // Lock p1 to the first rev in the git repo @@ -1193,7 +1193,7 @@ test!(git_repo_changing_no_rebuild { // Make a commit to lock p2 to a different rev File::create(&bar.root().join("src/lib.rs")).write_str(r#" - pub fn bar() -> int { 2 } + pub fn bar() -> i32 { 2 } "#).unwrap(); let repo = git2::Repository::open(&bar.root()).unwrap(); add(&repo); @@ -1256,7 +1256,7 @@ test!(git_dep_build_cmd { name = "bar" "#) .file("bar/src/bar.rs.in", r#" - pub fn gimme() -> int { 0 } + pub fn gimme() -> i32 { 0 } "#) .file("bar/build.rs", r#" use std::old_io::fs; @@ -1278,7 +1278,7 @@ test!(git_dep_build_cmd { // Touching bar.rs.in should cause the `build` command to run again. let mut file = fs::File::create(&p.root().join("bar/src/bar.rs.in")).unwrap(); - file.write_str(r#"pub fn gimme() -> int { 1 }"#).unwrap(); + file.write_str(r#"pub fn gimme() -> i32 { 1 }"#).unwrap(); drop(file); assert_that(p.process(cargo_dir().join("cargo")).arg("build"), @@ -1297,7 +1297,7 @@ test!(fetch_downloads { version = "0.5.0" authors = ["wycats@example.com"] "#) - .file("src/lib.rs", "pub fn bar() -> int { 1 }") + .file("src/lib.rs", "pub fn bar() -> i32 { 1 }") }).unwrap(); let p = project("p1") @@ -1569,7 +1569,7 @@ test!(update_one_source_updates_all_packages_in_that_git_source { // Just be sure to change a file File::create(&dep.root().join("src/lib.rs")).write_str(r#" - pub fn bar() -> int { 2 } + pub fn bar() -> i32 { 2 } "#).unwrap(); add(&repo); commit(&repo); diff --git a/tests/test_cargo_compile_plugins.rs b/tests/test_cargo_compile_plugins.rs index 853038ff3..ca44a4dbf 100644 --- a/tests/test_cargo_compile_plugins.rs +++ b/tests/test_cargo_compile_plugins.rs @@ -23,14 +23,14 @@ test!(plugin_to_the_max { "#) .file("src/main.rs", r#" #![feature(plugin)] - #[plugin] #[no_link] extern crate bar; + #![plugin(bar)] extern crate foo_lib; fn main() { foo_lib::foo(); } "#) .file("src/foo_lib.rs", r#" #![feature(plugin)] - #[plugin] #[no_link] extern crate bar; + #![plugin(bar)] pub fn foo() {} "#); @@ -122,7 +122,7 @@ test!(plugin_with_dynamic_native_dependency { "#) .file("src/main.rs", r#" #![feature(plugin)] - #[plugin] #[no_link] extern crate bar; + #![plugin(bar)] fn main() {} "#) diff --git a/tests/test_cargo_cross_compile.rs b/tests/test_cargo_cross_compile.rs index a2d53e0bb..cf6b9a586 100644 --- a/tests/test_cargo_cross_compile.rs +++ b/tests/test_cargo_cross_compile.rs @@ -12,7 +12,7 @@ fn setup() { fn disabled() -> bool { // First, disable if ./configure requested so - match env::var_string("CFG_DISABLE_CROSS_TESTS") { + match env::var("CFG_DISABLE_CROSS_TESTS") { Ok(ref s) if s.as_slice() == "1" => return true, _ => {} } @@ -44,7 +44,7 @@ test!(simple_cross { "#) .file("build.rs", format!(r#" fn main() {{ - assert_eq!(std::env::var_string("TARGET").unwrap().as_slice(), "{}"); + assert_eq!(std::env::var("TARGET").unwrap().as_slice(), "{}"); }} "#, alternate()).as_slice()) .file("src/main.rs", r#" @@ -119,8 +119,7 @@ test!(plugin_deps { "#) .file("src/main.rs", r#" #![feature(plugin)] - #[plugin] #[no_link] - extern crate bar; + #![plugin(bar)] extern crate baz; fn main() { assert_eq!(bar!(), baz::baz()); @@ -155,7 +154,7 @@ test!(plugin_deps { fn expand_bar(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { - MacExpr::new(quote_expr!(cx, 1i)) + MacExpr::new(quote_expr!(cx, 1)) } "#); let baz = project("baz") @@ -165,7 +164,7 @@ test!(plugin_deps { version = "0.0.1" authors = [] "#) - .file("src/lib.rs", "pub fn baz() -> int { 1 }"); + .file("src/lib.rs", "pub fn baz() -> i32 { 1 }"); bar.build(); baz.build(); @@ -197,8 +196,7 @@ test!(plugin_to_the_max { "#) .file("src/main.rs", r#" #![feature(plugin)] - #[plugin] #[no_link] - extern crate bar; + #![plugin(bar)] extern crate baz; fn main() { assert_eq!(bar!(), baz::baz()); @@ -320,7 +318,7 @@ test!(plugin_with_extra_dylib_dep { "#) .file("src/main.rs", r#" #![feature(plugin)] - #[plugin] #[no_link] extern crate bar; + #![plugin(bar)] fn main() {} "#); @@ -362,7 +360,7 @@ test!(plugin_with_extra_dylib_dep { name = "baz" crate_type = ["dylib"] "#) - .file("src/lib.rs", "pub fn baz() -> int { 1 }"); + .file("src/lib.rs", "pub fn baz() -> i32 { 1 }"); bar.build(); baz.build(); @@ -464,8 +462,8 @@ test!(cross_with_a_build_script { .file("build.rs", format!(r#" use std::env; fn main() {{ - assert_eq!(env::var_string("TARGET").unwrap().as_slice(), "{0}"); - let mut path = Path::new(env::var_string("OUT_DIR").unwrap()); + assert_eq!(env::var("TARGET").unwrap().as_slice(), "{0}"); + let mut path = Path::new(env::var("OUT_DIR").unwrap()); assert_eq!(path.filename().unwrap(), b"out"); path.pop(); assert!(path.filename().unwrap().starts_with(b"foo-")); @@ -530,7 +528,7 @@ test!(build_script_needed_for_host_and_target { .file("d1/build.rs", r#" use std::env; fn main() { - let target = env::var_string("TARGET").unwrap(); + let target = env::var("TARGET").unwrap(); println!("cargo:rustc-flags=-L /path/to/{}", target); } "#) @@ -643,9 +641,9 @@ test!(build_script_only_host { use std::env; fn main() { - assert!(env::var_string("OUT_DIR").unwrap() + assert!(env::var("OUT_DIR").unwrap() .contains("target/build/d1-"), - "bad: {:?}", env::var_string("OUT_DIR")); + "bad: {:?}", env::var("OUT_DIR")); } "#); diff --git a/tests/test_cargo_profiles.rs b/tests/test_cargo_profiles.rs index b71eadb34..827393f92 100644 --- a/tests/test_cargo_profiles.rs +++ b/tests/test_cargo_profiles.rs @@ -1,4 +1,4 @@ -use std::os; +use std::env; use std::old_path; use support::{project, execs}; @@ -110,6 +110,6 @@ test!(top_level_overrides_deps { dir = p.root().display(), url = p.url(), sep = old_path::SEP, - prefix = os::consts::DLL_PREFIX, - suffix = os::consts::DLL_SUFFIX).as_slice())); + prefix = env::consts::DLL_PREFIX, + suffix = env::consts::DLL_SUFFIX).as_slice())); }); -- 2.30.2